<template>
  <view class="container">
    <view class="intro">本项目已包含uni ui组件，无需import和注册，可直接使用。在代码区键入字母u，即可通过代码助手列出所有可用组件。光标置于组件名称处按F1，即可查看组件文档。</view>
    <text class="intro">详见：</text>
    <uni-link :href="href" :text="href"></uni-link>
    <!-- 一般用法 -->
    <uni-grid :column="3" @change="onClickChange">
      <uni-grid-item :index=1>
        <text class="text">文本</text>
      </uni-grid-item>
      <uni-grid-item :index=2>
        <text class="text">文本</text>
      </uni-grid-item>
      <uni-grid-item :index=3>
        <text class="text">文本</text>
      </uni-grid-item>
    </uni-grid>
  </view>
</template>

<script>
    import Core from 'core/core'

    export default {
        data() {
            return {
                href: 'https://uniapp.dcloud.io/component/README?id=uniui'
            }
        },
        onLoad() {
            let hello = Core.Data.get('hello')
            if (hello) {
                console.log(hello)
            } else {
                Core.Data.set('hello', 'world')
                console.log(Core.Data.get('hello'))
            }

            Core.Event.on("wx-test", res => {
                console.log(res, 111)
            })

            // Core.Api.Wx.decrypt({
            //     code: '111'
            // }).then(res => {
            //
            // }).catch(err => {
            //     console.log(err, 111)
            // })
        },
        methods: {
            onClickChange(e) {
                console.log(e.detail.index)
                let index = e.detail.index;
                if (index == 1) {
                    Core.Util.go(`/pages/login/index`)
                } else if (index == 2) {
                    Core.Util.go(`/pages/register/index`)
                }
            }
        }
    }
</script>

<style lang="scss" scoped>
  @import "./index.scss";
</style>

